/*
-----------------------------------------------------------------------------
This source file is part of QuickGUI
For the latest info, see http://www.ogre3d.org/addonforums/viewforum.php?f=13

Copyright (c) 2009 Stormsong Entertainment

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

(http://opensource.org/licenses/mit-license.php)
-----------------------------------------------------------------------------
*/

#ifndef QUICKGUICHARACTER_H
#define QUICKGUICHARACTER_H

#include "QuickGUIExportDLL.h"
#include "QuickGUIRect.h"
#include "QuickGUIUVRect.h"
#include "QuickGUIOgreEquivalents.h"

#include "OgreUTFString.h"

namespace Ogre
{
	// forward declarations
	class Font;
	class Texture;
}

namespace QuickGUI
{
	class _QuickGUIExport Character
	{
	public:
		Character(Ogre::UTFString::code_point cp, Ogre::Font* fp, ColourValue cv);		

		/**
		* Returns true if this character is highlighted, false otherwise.
		*/
		bool getHighlighted();
		/**
		* Returns the color of the text background when highlighted.
		*/
		ColourValue getHighlightColor();
		/**
		* Returns the color of the text when highlighted.
		*/
		ColourValue getHighlightedTextColor();

		/**
		* Returns true if this character is a tab, newline, carriage return, space, or other whitespace.
		*/
		bool isWhiteSpace();

		/**
		* Updates fontPtr member variable and recalculates uv coords and dimensions.
		*/
		void setFont(Ogre::Font* fp);
		/**
		* Sets whether this character is highlighted or not.
		*/
		void setHighlighted(bool highlighted);

		/// Code point of the glyph
		Ogre::UTFString::code_point codePoint;
		/// Color of the character when drawn.
		ColourValue colorValue;
		/// Position is relative to the parent TextLine
		Rect dimensions;
		/// Font of the glyph being drawn.
		Ogre::Font* fontPtr;
		/// member allowing fast access to font texture name
		Ogre::Texture* texturePtr;
		/// UV coords of glyph, retreived from Font texture generated by Ogre::Font class.
		UVRect uvCoords;

	protected:
		Character();

		bool mHighlighted;
		bool mWhiteSpace;
	};
}

#endif
